package org.panda.ibog.controller;

import org.panda.ibog.domain.MarkdownTextBean;
import org.panda.ibog.domain.RenderedMarkdonwTextBean;
import org.panda.ibog.service.SimpleMarkdownService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/")
public class SimpleMarkdownController {

    private int i;

    @Autowired
    private SimpleMarkdownService markdownService;

    @RequestMapping(path = "markdown2",method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public String parse2(){
        String result = markdownService.parse2("This is *Sparta*");
        return result;
    }

    @RequestMapping(path = "markdown")
    @ResponseBody
    @CrossOrigin
    public RenderedMarkdonwTextBean parse(@RequestBody MarkdownTextBean textBean){
        return markdownService.parse(textBean);
    }
}
